package com.example.demo.configuration;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

@Configuration
public class AliyunOssConfig {
    @Bean
    @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    public static OSS ossClient() {

        String endpoint = "oss-cn-beijing.aliyuncs.com";

        String accessKeyId = "LTAI5tGH4PY8vNtYTdQvEja6";

        String accessKeySecret = "JzLAO8eHPiaMGZAizhskckailRuAYJ";

        OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);

        return ossClient;

    }
}
